<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>确定地址</title>
<script type="text/javascript"
	src="http://webapi.amap.com/maps?v=1.3&amp;key=f9d326eec206fa5f8ae57ccb028fc9bb&amp;"></script>
<link href="${ctx }/styles/BJUI/new/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font-awesome 图标 CSS库 -->
<link href="${ctx }/styles/BJUI/new/css/font-awesome.min.css"
	rel="stylesheet">
<!-- JQuery UI CSS库 -->
<link href="${ctx }/styles/BJUI/new/css/jquery-ui.min.css"
	rel="stylesheet">
<!-- JQuery -->
<script src="${ctx }/styles/BJUI/new/js/jquery-1.10.2.min.js"
	type="text/javascript"></script>
<script src="${ctx }/styles/BJUI/new/js/jquery.unobtrusive-ajax.min.js"
	type="text/javascript"></script>
<!-- JQuery UI -->
<script src="${ctx }/styles/BJUI/new/js/jquery-ui.min.js"
	type="text/javascript"></script>
<!-- 脉动提示插件 -->
<script src="${ctx }/styles/BJUI/new/js/jquery.pulsate.min.js"
	type="text/javascript"></script>
<!-- Bootstrap 核心 JS库 -->
<script src="${ctx }/styles/BJUI/new/js/bootstrap.min.js"
	type="text/javascript"></script>
<!-- 浏览器判断 -->
<script src="${ctx }/styles/BJUI/new/js/Browser.js"
	type="text/javascript"></script>
<!-- 母版页 样式 -->
<link href="${ctx }/styles/BJUI/new/css/carousel.css" rel="stylesheet">
<link href="${ctx }/styles/BJUI/new/css/style.css" rel="stylesheet">
<link href="${ctx }/styles/BJUI/new/css/leon.css" rel="stylesheet">
<link href="${ctx }/styles/BJUI/new/css/index.css" rel="stylesheet">
</head>
<body>
	<form id="form" class="form-inline" action="">
		<div class="clearfix">
			<div class="carousel-inner" style="background-color:transparent">
				<div class="row">
					<div class="col-sm-8" style="background-color:#ffffff;width:100%">
						<div class="label-text" style="color: #0099CC">你的寄件地址是:</div>
						<div class="label-text">${Address}</div>
						<input class="input-max display-right"  id="tipinput"    onblur="a()"
							style="border: 1px solid #deddde ;height:auto"
							placeholder="请准确填写楼号、小区号等详细信息 "> <br> <br>
						<div style="padding: 10px;" onclick="geocoder2()">
							<a class="a-orange" target="_blank" data-toggle="modal"
								data-target="#StudentModal" tabindex="-1">
								<div class="text-center">
									<span style="line-height: 40px;color: #ffffff">确定</span>
								</div>
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--		<input type="hidden" name="originLongitude" id="originLongitude"
			value="${list.originLongitude}" /> <input type="hidden"
			name="originLatitude" id="originLatitude"
			value="${list.originLatitude}" /> <input type="hidden"
			name="destinationLatitude" id="destinationLatitude"
			value="${list.destinationLatitude}" /> <input type="hidden"
			name="destinationLongitude" id="destinationLongitude"
			value="${list.destinationLongitude}" /> <input type="hidden"
			name="vehicleType" id="vehicleType" value="${list.vehicleType}" /> <input
			type="hidden" name="distance" id="distance"
			value="${list.vehicleType}" /> <input type="hidden" name="payType"
			id="payType" value="2" /> <input type="hidden" name="money"
			id="money" value="${list.money}" /> <input type="hidden"
			name="launchAccountId" id="launchAccountId"
			value="${list.launchAccountId}" /> <input id="originAddress"
			name="originAddress" type="hidden" value="${list.originAddress}">
		<input id="destinationAddress" name="destinationAddress" type="hidden"
			value="${list.destinationAddress}"> <input id="originName"
			name="originName" type="hidden" value="${list.originName}"> <input
			id="originPhone" name="originPhone" type="hidden"
			value="${list.originPhone}"> <input id="destinationName"
			name="destinationName" type="hidden"
			value="${list.destinationAddress}"> <input
			id="destinationPhone" name="destinationPhone" type="hidden"
			value="${list.destinationAddress}"><input id="goodsName"
			name="goodsName" type="hidden" value="${list.goodsName}"><input
			id="remarks" name="remarks" type="hidden" value="${list.remarks}">
		<input id="addPrice" name="addPrice" type="hidden"
			value="${list.addPrice}"-->
	</form>
	<script type="text/javascript">
		AMap.service([ "AMap.Geocoder", "AMap.Driving" ], function() { //加载地理编码

		});
		//2-2目地地的经度纬度
		function geocoder2() {
			var str = "${Address}";
			if ($("input[id='tipinput']").val() != null) {
				str = str + $("input[id='tipinput']").val();
			}

			var geocoder = new AMap.Geocoder({
				city : "南宁市", //城市，默认：“全国”
				radius : 1000
			//范围，默认：500
			});
			//地理编码,返回地理编码结果
			geocoder
					.getLocation(
							str,
							function(status, result) {
								if (status === 'complete'
										&& result.info === 'OK') {
									//			$("input[id='destinationLongitude']").val(
									//					result['geocodes'][0]['location']['lng']);
									//			$("input[id='destinationLatitude']").val(
									//					result['geocodes'][0]['location']['lat']);
									//			$("#destinationAddress").val(str);
									var lng = result['geocodes'][0]['location']['lng'];
									var lat = result['geocodes'][0]['location']['lat'];
									var PositionType = "${PositionType}";
									address = encodeURI(str);
							//		alert("PositionType=" + PositionType
								//			+ "<br> lat=" + lat + "<br>lng="
							//				+ lng + "<br>address" + str);
									if (PositionType == 1) {
										window.location.href = "${ctx }/weixin/order.do?destinationLatitude="
												+ lat
												+ "&destinationLongitude="
												+ lng
												+ "&destinationAddress="
												+ encodeURI(address)
												+ "&positionType="
												+ PositionType;
									}
									if (PositionType == 2) {
										window.location.href = "${ctx }/weixin/order.do?originLatitude="
												+ lat
												+ "&originLongitude="
												+ lng
												+ "&originAddress="
												+ encodeURI(address)
												+ "&positionType="
												+ PositionType;
									}
								}
							});
		}
	</script>
</body>
</html>
